CXX	= g++
GDB	= "C:\Apps\local\cygwin\bin\gdb.exe"
CFLAGS	= -Wall -g

SERVER		= server.exe
SERVER_OBJECTS	= server.o common.o socket.o
SERVER_LIBS	= -lncurses

ROBOT		= robot.exe
ROBOT_OBJECTS	= robot.o common.o socket.o
ROBOT_LIBS	=

TARGETS		= $(SERVER) $(ROBOT)

all: $(TARGETS)
	$(MAKE) -C myrobot
	$(MAKE) -C eeightrobot

clean:
	rm -f *.o $(TARGETS) *.core *.stackdump
	$(MAKE) -C myrobot clean
	$(MAKE) -C eeightrobot clean
	
debug: $(ROBOT)
	$(GDB) $(ROBOT)

$(SERVER): $(SERVER_OBJECTS)
	$(CXX) -o $(SERVER) $(CFLAGS) $(SERVER_OBJECTS) $(SERVER_LIBS)

$(ROBOT): $(ROBOT_OBJECTS)
	$(CXX) -o $(ROBOT) $(CFLAGS) $(ROBOT_OBJECTS) $(ROBOT_LIBS)

.cpp.o:
	$(CXX) -c $(CFLAGS) $<

socket.o: socket.h
common.o: common.h
robot.o: robot.h
